<?php

if (!empty($_REQUEST['action'])) {
    try {

        $action = explode('/', $_REQUEST['action']);
        $class_name = $action[0];
        $method_name = $action[1];
        // 判断文件是否存在
        if (file_exists( __DIR__ . '/'.$class_name . '.php')) {
             // 加载框架文件
             require __DIR__ . '/'.$class_name . '.php';

        } else {
             throw new Exception($class_name . '.php is not exists ');
        }
       
        $class = new ReflectionClass($class_name);
        if (class_exists($class_name)) {
            if ($class->hasMethod($method_name)) {
                $func = $class->getmethod($method_name);
                $instance = $class->newInstance();
                $func->invokeArgs($instance, array($_REQUEST));
                $result = $instance->getResult();
                echo $result;
            }
        }
    } catch (Exception $exc) {
        echo "".__DIR__;
        echo $exc->getMessage();
        exit;
    }
}


?>